//
//  PackageView.swift
//  KaMengApplication
//
//  Created by DUONIU_MAC on 2018/10/8.
//  Copyright © 2018年 DUONIU_MAC. All rights reserved.
//

import UIKit

class PackageView: UIView {
    
    let creditView = CreditView()
    let debitView = DebitView()

    init() {
        super.init(frame: .zero)
        
        self.backgroundColor = UIColor.lightGray
        
        let imageView = UIImageView()
        imageView.image = #imageLiteral(resourceName: "card")
        self.addSubview(imageView)
        
        let titleLabel = UILabel()
        titleLabel.text = addCard
        titleLabel.textColor = UIColor.phoneColor()
        titleLabel.font = UIFont.systemFont(ofSize: RATIO(maxNum: 14))
        self.addSubview(titleLabel)
        
        let textLabel = UILabel()
        textLabel.text = operateCard
        textLabel.textColor = UIColor.gray
        textLabel.font = UIFont.systemFont(ofSize: RATIO(maxNum: 14))
        self.addSubview(textLabel)
        
        creditView.isHidden = true
        self.addSubview(creditView)
        
        debitView.isHidden = true
        self.addSubview(debitView)
        
        imageView.snp.makeConstraints { (make) in
            make.top.equalToSuperview().offset(RATIO_H(maxNum: 30))
            make.centerX.equalToSuperview()
            make.width.height.equalTo(RATIO_H(maxNum: 100))
        }
        
        titleLabel.snp.makeConstraints { (make) in
            make.top.equalTo(imageView.snp.bottom).offset(RATIO_H(maxNum: 10))
            make.centerX.equalTo(imageView)
            make.width.greaterThanOrEqualTo(10)
            make.height.greaterThanOrEqualTo(10)
        }
        
        textLabel.snp.makeConstraints { (make) in
            make.top.equalTo(titleLabel.snp.bottom).offset(RATIO_H(maxNum: 20))
            make.centerX.equalTo(titleLabel)
            make.width.greaterThanOrEqualTo(10)
            make.height.greaterThanOrEqualTo(10)
        }
        
        creditView.snp.makeConstraints { (make) in
            make.edges.equalToSuperview().inset(UIEdgeInsets.zero)
        }
        
        debitView.snp.makeConstraints { (make) in
            make.edges.equalToSuperview().inset(UIEdgeInsets.zero)
        }
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
}
